<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
    <style type="text/css">
        body, html,#allmap {width: 100%;height: 100%;margin:0;font-family:"微软雅黑";font-size:14px;}
        #l-map{height:500px;width:100%;}
        #r-result{width:100%;}
    </style>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=x5vclXHQrsZDYGfxZnlF16TvO2qyoE4d"></script>
    <link rel="stylesheet" href="/css/pintuer.css">
    <link rel="stylesheet" href="/css/admin.css">
    <script src="/js/jquery.js"></script>
    <script src="/js/pintuer.js"></script>
    <script src="/js/vuejs-2.5.16.js"></script>
    <script src="/js/axios-0.18.0.js"></script>
    <!-- 引入样式 -->
    <link rel="stylesheet" href="/element-ui/lib/theme-chalk/index.css">
    <!-- 引入组件库 -->
    <script src="/element-ui/lib/index.js"></script>
    <title>该用户所在位置</title>
</head>
<body>
<div>
    <a class="button border-main" href="/user_list.html"><span class="icon-edit"></span>返回</a>
</div>



<div id="l-map"></div>
<div id="r-result"></div>
</body>
</html>

<script type="text/javascript" >
    //发送请求获取地理位置

    let zuobiao;
    let userId=location.search.split("=")[1];
    console.log(userId)

        if (userId) {
            axios.get("/manage/users/findLocation?userId="+userId).then(resp=>{

                zuobiao=resp.data;

                console.log(zuobiao)
                let longitude=zuobiao[0];
                let latitude=zuobiao[1];
                let address=zuobiao[2]
                // 百度地图API功能
                var sContent =address;
                var map = new BMap.Map("l-map");
                var point = new BMap.Point(longitude, latitude);
                map.centerAndZoom(point, 15);
                var infoWindow = new BMap.InfoWindow(sContent);  // 创建信息窗口对象
                map.openInfoWindow(infoWindow,point); //开启信息窗口
                map.enableScrollWheelZoom();//启动鼠标滚轮缩放地图
                document.getElementById("r-result").innerHTML = "信息窗口的内容是：<br />" + infoWindow.getContent();
            })
        }





</script>
